using System;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using System.ComponentModel.Design;
using AjaxControlToolkit;

[assembly: System.Web.UI.WebResource("ReserveSocietyControls.ImageProgressControlBehavior.js", "text/javascript")]

namespace ReserveSocietyControls
{
    [Designer(typeof(ImageProgressControlDesigner))]
    [ClientScriptResource("ReserveSocietyControls.ImageProgressControlBehavior", "ReserveSocietyControls.ImageProgressControlBehavior.js")]
    [TargetControlType(typeof(Image))]
    public class ImageProgressControlExtender : ExtenderControlBase
    {
        [TypeConverter("System.Web.UI.Design.UpdateProgressAssociatedUpdatePanelIDConverter")]
        [Category("Behavior")]
        [DefaultValue("")]
        [ExtenderControlProperty]
        [IDReferenceProperty(typeof(UpdatePanel))]
        public string AssociatedUpdatePanelId 
        {
            get
            {
                return GetPropertyValue("AssociatedUpdatePanelId", "");
            }
            set
            {
                SetPropertyValue("AssociatedUpdatePanelId", value);
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Image control = base.TargetControl as Image;
            if (control != null)
            {
                control.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");
            }
        }
    }
}
